{include file="public/header" /}
<article class="page-container">
    <form action="" method="post" class="form form-horizontal" id="form-member-add">
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>规则：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="{$row.name|default=''}" placeholder="模块/控制器/方法(一级菜单规则和名称一样)" name="name"> 
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>名称：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="{$row.title|default=''}" placeholder="菜单名称" name="title"> 
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>状态：</label>
            <div class="formControls col-xs-8 col-sm-8 skin-minimal">
                <div class="radio-box">
                    <input type="radio" id="sex-1" name="status" value="1" {$row.status==1?'checked':''} >
                    <label for="sex-1">启用</label>
                </div>
                <div class="radio-box">
                    <input type="radio" id="sex-2" name="status" value="0" {$row.status==0?'checked':''} >
                    <label for="sex-2">禁用</label>
                </div>
            </div>
            <div class="col-4"> </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">上级菜单：</label>
            <div class="formControls col-xs-8 col-sm-8"> <span class="select-box">
                <select class="select" size="1" name="parent_id">
                    <option value="0">=作为一级菜单=</option>
                    {volist name="list" id="v"}
                        <option value="{$v.id}" {if isset($row.parent_id) }{$row.parent_id==$v['id']?'selected':''}{/if}>
                            {:str_repeat('├──',$v['level'])}{$v.title}
                        </option>
                    {/volist}
                </select>
            </span> </div>
            <div class="col-4"> </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">ico：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="{$row.ico|default=''}" placeholder="ico" name="ico"> 
            </div>
        </div>

        <div class="row cl">
            <input type="hidden" value="{$row.sort|default='0'}" name="sort">
            <input type="hidden" value="{$row.id|default=''}" name="id">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>
    </form>
</article>

{include file="public/footer" /}
<script type="text/javascript">
$(function(){
    $('.skin-minimal input').iCheck({
        checkboxClass: 'icheckbox-blue',
        radioClass: 'iradio-blue',
        increaseArea: '20%'
    });

    $("#form-member-add").validate({
        onkeyup:false,
        focusCleanup:true,
        success:"valid",
        submitHandler:function(form){
            $(form).ajaxSubmit({
                success:function(data){
                    console.log(data);
                    if(data.status == 'y'){
                        layer.msg("操作成功",{icon:1,time:1000,shade: [0.3, '#000']},function(){
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.location.reload();
                            parent.layer.close(index);
                        });
                    }else{
                        layer.msg(data.info,{icon:2,time:1000,shade: [0.3, '#000']});
                    }
                },
                error:function(error){
                    layer.msg('系统发生了错误',{icon:2,time:3000,shade: [0.5, '#FF0000']});
                }
            });
        }
    });
});
</script> 
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>